package com.eight.paper.admin.domain.model.enums;

import java.util.HashMap;
import java.util.Map;


public enum PaperTypeEnum {

    Fixed("0", "固定试卷"),
    Duration("1", "时段试卷"),
    Task("2", "任务试卷");

    String code;
    String name;

    PaperTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }


    private static final Map<String, PaperTypeEnum> keyMap = new HashMap<>();

    static {
        for (PaperTypeEnum item : PaperTypeEnum.values()) {
            keyMap.put(item.getCode(), item);
        }
    }

    public static PaperTypeEnum fromCode(String code) {
        return keyMap.get(code);
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
